#include "optiondialog.h"

OptionDialog::OptionDialog(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	mainWnd=(visual *)parent;

	ui.animBox->setChecked(mainWnd->options.anim);
	ui.logBox->setChecked(mainWnd->options.log);
	ui.codeBox->setChecked(mainWnd->options.code);

	connect(ui.animBox,		    SIGNAL(stateChanged(int)),		this, SLOT(anim(int)));
	connect(ui.logBox,	        SIGNAL(stateChanged(int)),		this, SLOT(log(int)));
	connect(ui.codeBox,			SIGNAL(stateChanged(int)),		this, SLOT(code(int)));
	connect(ui.closeButton,		SIGNAL(clicked()),				this, SLOT(close()));
}

OptionDialog::~OptionDialog(){}

void OptionDialog::log(int x)
{
	if(x==0)
		mainWnd->options.log=false;
	else if(x==2)
		mainWnd->options.log=true;
}

void OptionDialog::code(int x)
{
	if(x==0)
		mainWnd->options.code=false;
	else if(x==2)
		mainWnd->options.code=true;
}

void OptionDialog::anim(int x)
{
	if(x==0)
		mainWnd->options.anim=false;
	else if(x==2)
		mainWnd->options.anim=true;
}